package cc.realxyq.demo.aop;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * 业务类
 * @author kwhan
 * @date 2022年01月10日 12:45
 */
@Slf4j
public class Calculator implements InitializingBean, DisposableBean {

    public Calculator(){
        log.info("无参构造器被调用了。。。。。。。。");
    }

    public Integer divide(Integer x, Integer y ){
        log.error("业务操作。。。。。");
        return x/y;
    }

    @PreDestroy
    public void haha() {
        log.info("JSR-250 @Pre-destroy *************");
    }
    @PostConstruct
    public void initMethod(){
        log.info("@postConstruct。。。。");
    }

    @Override
    public void afterPropertiesSet() {
        log.info("initializationBean");

    }

    public void init(){
        log.info("init-method。。。。。");
    }
    public void close(){
        log.info("自定义销毁方法。。。");
    }

    @Override
    public void destroy() {
        log.info("disposableBean.........");
    }
}
